#include "Pipe.h"
#include "ResourceManager.h"
#include <d3dx9.h>

Pipe::Pipe(int id,float x, float y, int type, int state)
{
	switch (type)
	{
	case 29:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Pipe_H_Left),0, 0);
		break;
	case 30:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Pipe_H_Middle),0, 0);
		break;
	case 31:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Pipe_H_Right),0, 0);
		break;
	case 32:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Pipe_V_Top),0, 0);
		break;
	case 33:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Pipe_V_Middle),0, 0);
		break;
	case 34:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Pipe_V_Bottom),0, 0);
		break;
	case 48:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Pipe_H_Left_2),0, 0);
		break;
	case 49:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Pipe_H_Middle_2),0, 0);
		break;
	case 50:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Pipe_H_Right_2),0, 0);
		break;
	case 53:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Pipe_V_Top_2),0, 0);
		break;
	case 52:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Pipe_V_Middle_2),0, 0);
		break;
	case 51:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Pipe_V_Bottom_2),0, 0);
		break;
	case 64:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Pipe_H_Left_3),0, 0);
		break;
	case 65:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Pipe_H_Middle_3),0, 0);
		break;
	case 66:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Pipe_H_Right_3),0, 0);
		break;
	case 69:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Pipe_V_Top_3),0, 0);
		break;
	case 68:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Pipe_V_Middle_3),0, 0);
		break;
	case 67:
		_sprite = new Sprite(_spriteHandler, ResourceManager::GetInstance()->GetTexture(ResourceManager::GetInstance()->TextureName.Pipe_V_Bottom_3),0, 0);
		break;
	}
	_id = id;
	_x = x;
	_y = y;
	_width = _sprite->getTexture()->getWidth();
	_height = _sprite->getTexture()->getHeight();
	_state = state;
	
}

Pipe::~Pipe(void)
{
	if (_sprite)
	{
		delete _sprite;
	}
	
}

void Pipe::Update(list<Object *> *_list, float time)
{
}


void Pipe:: Render(int vpX, int vpY)
{
	_sprite->Render(_x, _y, vpX, vpY);
}

OBJECT_TYPE Pipe::getObjectType()
{
	return OBJECT_LAND;
}